def fuzzy_search(input, business_file='/home/lxy/wxbdata/merge_website_replace_add_question.jsonl', top_k=3):
    from request_chatgpt_myy import make_requests
    from thefuzz import fuzz
    import json

    # # 请求GPT获得现在办理的业务名称
    # prompt = "以下是用户在东北大学信网办业务时向系统助手提问的问题，帮我抽取出用户具体在办理哪一个业务，只回复业务名称，其他不要回复\n"
    # prompt += f"用户问题：{input}\n"
    # prompt += f"业务名称：{input}\n"
    # prompt = {"role": "user", "content": prompt}

    # response = make_requests(
    #     engine="gpt-3.5-turbo",
    #     prompts=[prompt],
    #     temperature=0.7,
    #     top_p=1,
    #     frequency_penalty=0,
    #     presence_penalty=2,
    #     stop_sequences=[]
    # )
    # key = response[0]["response"]["choices"][0]["message"]["content"]

    # 模糊匹配
    business_list = list()
    business_file = open(business_file, "r", encoding="utf-8")
    lines = business_file.readlines()
    for line in lines:
        line_dict = json.loads(line)
        name_key = line_dict["name"]
        question_list = line_dict["question"]
        score_name = fuzz.token_sort_ratio(input, name_key)
        score_question = 0
        for question_key in question_list:
            score_question += fuzz.token_sort_ratio(input, question_key) 
        score_question = score_question / len(question_list)

        # print(f"score_name:{score_name}")
        # print(f"score_question:{score_question}")

        line_dict["score"] = score_name*0.5+score_question*0.5
        business_list.append(line_dict)

    # 取topk个
    return_prompts = list()
    business_list.sort(key=lambda x:x["score"])
    for i in range(top_k):
        business = business_list.pop()
        print(business["score"])
        if business["score"] < 40:
            continue
        name = business["name"]
        procedure = business["procedure"]
        condition = business["condition"]
        website = business["website"]
        department = business["department"]
        return_prompt = f"业务名称：{name}\n\n" # 用的\n
        return_prompt += f"办理流程：{procedure}\n\n"
        return_prompt += f"办理条件：{condition}\n\n"
        return_prompt += f"负责部门：{department}\n\n"
        return_prompt += f"办理网址：{website}\n\n"
        return_prompts.append(return_prompt)

    return return_prompts
